package com.jbm.onehome.iface;

import com.jbm.core.iface.IAcross;
import org.hibernate.annotations.*;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.sql.Timestamp;

/**
 * Created by lyh on 2017-02-28.
 */
@Entity
@Table(name = "login", schema = "", catalog = "")
@org.hibernate.annotations.Entity(dynamicUpdate=true,dynamicInsert=true)
public class LoginEntity extends IAcross
{
    private static final long serialVersionUID = -7073671644678691062L;
    @Transient
    public boolean back;
    @Transient
    public String method;
    @Transient
    public String errorinfo;
    @Transient
    public int count;
    @Transient
    public int start=0;
    @Transient
    public int pagesize=0;
    @Transient
    public Integer tableid;
    private int loginId;
    private Integer funId;
    private String account;
    private String password;
    private String nickname;
    private String logo;
    private String status;
    private String confirmCode;
    private Timestamp ccodeExpire;
    private Timestamp createDate;
    private int createId;
    private Timestamp lastLogin;
    private Timestamp lastChangepwd;
    private Integer changepwdId;
    private Timestamp lastUpdate;
    private Integer updateId;
    private AccSecretEntity accSecretEntity;
    private byte[] logobyte;
    private String promotcode;



	public LoginEntity()
	{
		super();
	}

	public LoginEntity(IAcross ia)
	{
		super(ia);
	}

    public LoginEntity(int code, String info)
    {
        super(code,info);
    }

    public LoginEntity(String method,String account,String password){
        this.method=method;
        this.account=account;
        this.password=password;

    }

    public LoginEntity(String method,int loginId, String nickname,int sex){
             this.method=method;
        this.nickname=nickname;
        this.loginId=loginId;
        AccSecretEntity t=new    AccSecretEntity();
        t.setSex(sex);
        this.accSecretEntity=t;
    }

    public LoginEntity(String method,int loginId,  byte[] logobyte,String logo){
        this.method=method;

        this.loginId=loginId;
        this.logo=logo;
        this.setLogobyte(logobyte);
    }

    public LoginEntity(boolean back,String errinfo){
        this.back=back;
        this.errorinfo=errinfo;
    }

    @Id
    @Column(name = "login_id")
    @GeneratedValue
    public int getLoginId() {
        return loginId;
    }

    public void setLoginId(int loginId) {
        this.loginId = loginId;
    }

    @Basic
    @Column(name = "fun_id")
    public Integer getFunId() {
        return funId;
    }

    public void setFunId(Integer funId) {
        this.funId = funId;
    }

    @Basic
    @Column(name = "account")
    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    @Basic
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "nickname")
    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    @Basic
    @Column(name = "logo")
    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    @Basic
    @Column(name = "status", length = 10)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "confirm_code")
    public String getConfirmCode() {
        return confirmCode;
    }

    public void setConfirmCode(String confirmCode) {
        this.confirmCode = confirmCode;
    }

    @Basic
    @Column(name = "ccode_expire")
    public Timestamp getCcodeExpire() {
        return ccodeExpire;
    }

    public void setCcodeExpire(Timestamp ccodeExpire) {
        this.ccodeExpire = ccodeExpire;
    }

    @Basic
    @Column(name = "create_date")
    public Timestamp getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Timestamp createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "create_id")
    public int getCreateId() {
        return createId;
    }

    public void setCreateId(int createId) {
        this.createId = createId;
    }

    @Basic
    @Column(name = "last_login")
    public Timestamp getLastLogin() {
        return lastLogin;
    }

    public void setLastLogin(Timestamp lastLogin) {
        this.lastLogin = lastLogin;
    }

    @Basic
    @Column(name = "last_changepwd")
    public Timestamp getLastChangepwd() {
        return lastChangepwd;
    }

    public void setLastChangepwd(Timestamp lastChangepwd) {
        this.lastChangepwd = lastChangepwd;
    }

    @Basic
    @Column(name = "changepwd_id")
    public Integer getChangepwdId() {
        return changepwdId;
    }

    public void setChangepwdId(Integer changepwdId) {
        this.changepwdId = changepwdId;
    }

    @Basic
    @Column(name = "last_update")
    public Timestamp getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Timestamp lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    @Basic
    @Column(name = "update_id")
    public Integer getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Integer updateId) {
        this.updateId = updateId;
    }

    @Basic
    @Column(name = "promotcode")
    public String getPromotcode() {
        return promotcode;
    }

    public void setPromotcode(String promotcode) {
        this.promotcode = promotcode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LoginEntity that = (LoginEntity) o;

        if (createId != that.createId) return false;
        if (loginId != that.loginId) return false;
        if (account != null ? !account.equals(that.account) : that.account != null) return false;
        if (ccodeExpire != null ? !ccodeExpire.equals(that.ccodeExpire) : that.ccodeExpire != null) return false;
        if (changepwdId != null ? !changepwdId.equals(that.changepwdId) : that.changepwdId != null) return false;
        if (confirmCode != null ? !confirmCode.equals(that.confirmCode) : that.confirmCode != null) return false;
        if (createDate != null ? !createDate.equals(that.createDate) : that.createDate != null) return false;
        if (funId != null ? !funId.equals(that.funId) : that.funId != null) return false;
        if (lastChangepwd != null ? !lastChangepwd.equals(that.lastChangepwd) : that.lastChangepwd != null)
            return false;
        if (lastLogin != null ? !lastLogin.equals(that.lastLogin) : that.lastLogin != null) return false;
        if (lastUpdate != null ? !lastUpdate.equals(that.lastUpdate) : that.lastUpdate != null) return false;
        if (logo != null ? !logo.equals(that.logo) : that.logo != null) return false;
        if (nickname != null ? !nickname.equals(that.nickname) : that.nickname != null) return false;
        if (password != null ? !password.equals(that.password) : that.password != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (updateId != null ? !updateId.equals(that.updateId) : that.updateId != null) return false;
         if (promotcode != null ? !promotcode.equals(that.promotcode) : that.promotcode != null) return false;
        return true;
    }

    @Override
    public int hashCode() {
        int result = loginId;
        result = 31 * result + (funId != null ? funId.hashCode() : 0);
        result = 31 * result + (account != null ? account.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
        result = 31 * result + (logo != null ? logo.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (confirmCode != null ? confirmCode.hashCode() : 0);
        result = 31 * result + (ccodeExpire != null ? ccodeExpire.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + createId;
        result = 31 * result + (lastLogin != null ? lastLogin.hashCode() : 0);
        result = 31 * result + (lastChangepwd != null ? lastChangepwd.hashCode() : 0);
        result = 31 * result + (changepwdId != null ? changepwdId.hashCode() : 0);
        result = 31 * result + (lastUpdate != null ? lastUpdate.hashCode() : 0);
        result = 31 * result + (updateId != null ? updateId.hashCode() : 0);
         result = 31 * result + (promotcode != null ? promotcode.hashCode() : 0);
        return result;
    }

    @Transient
    public AccSecretEntity getAccSecretEntity() {
        return accSecretEntity;
    }

    public void setAccSecretEntity(AccSecretEntity accSecretEntity) {
        this.accSecretEntity = accSecretEntity;
    }

    @Transient
    public byte[] getLogobyte() {
        return logobyte;
    }

    public void setLogobyte(byte[] logobyte) {
        this.logobyte = logobyte;
    }


   }
